import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:DELL
 * Date:2024-11-20
 * Time:20:35
 */
public class Test {
    //判断子序列
    public boolean isSubsequence(String S,String T){
        int lenS=S.length();
        int lenT=T.length();
        int i=0;
        int j=0;
        while (i<lenS&&j<lenT){
            if(S.charAt(i)==T.charAt(j)){
                i++;
                j++;
            }else {
                j++;
            }
        }
        return i==lenS;
    }
    //点击消除
    public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);
        while (scan.hasNextLine());
        String str=scan.nextLine();
        StringBuilder stringBuilder=new StringBuilder();
        int index=-1;
        for (int i = 0; i < str.length(); i++) {
            char ch=str.charAt(i);
            if(index==-1||ch!=stringBuilder.charAt(index)){
                stringBuilder.append(ch);
                index++;
            }else {
                stringBuilder.deleteCharAt(index);
                index--;
            }
        }
        if(index==-1){
            System.out.println('0');
        }else {
            System.out.print(stringBuilder);
        }
    }
}
